package me.illtamer.rpc.test;

import me.illtamer.rpc.api.ByeService;
import me.illtamer.rpc.api.HelloObject;
import me.illtamer.rpc.api.HelloService;
import me.illtamer.rpc.transport.RpcClient;
import me.illtamer.rpc.transport.RpcClientProxy;
import me.illtamer.rpc.transport.netty.client.NettyClient;
import me.illtamer.serializer.CommonSerializer;

public class NettyTestClient {

    public static void main(String[] args) {
        RpcClient client = new NettyClient(CommonSerializer.PROTOBUF_SERIALIZER);
        RpcClientProxy rpcClientProxy = new RpcClientProxy(client);
        HelloService service = rpcClientProxy.getProxy(HelloService.class);
        HelloObject object = new HelloObject(666, "Hello IllTamer!");
        String result = service.hello(object);
        System.out.println(result);
        ByeService byeService = rpcClientProxy.getProxy(ByeService.class);
        System.out.println(byeService.bye("Netty"));
    }

}
